package com.kgcx.system.controller;

import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.dbutils.domain.Region;
import com.kgcx.dbutils.utils.CityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 吴刚林
 * @date 2017/11/22
 */
@Api(description = "地理接口", tags = "地理接口")
@RestController
@RequestMapping("gis")
public class GisController extends BaseController {
    @ApiOperation(value = "获取区域省市", httpMethod = "GET", notes = "这是用来获取区域省市的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "省市区域名称", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("getCity")
    public ReturnData<Region> getCity(@RequestParam("name") String name) {
        return new ReturnData<>(CityUtils.getCityByName(name));
    }
}
